package org.htmlparser.tags;

import org.htmlparser.filters.AndFilter;
import org.htmlparser.filters.HasParentFilter;
import org.htmlparser.filters.IsEqualFilter;
import org.htmlparser.filters.NodeClassFilter;
import org.htmlparser.filters.NotFilter;
import org.htmlparser.filters.OrFilter;
import org.htmlparser.util.NodeList;

public class TableTag extends CompositeTag
{
  static Class class$org$htmlparser$tags$TableRow;
  static Class class$org$htmlparser$tags$TableTag;
  private static final String[] mEndTagEnders;
  private static final String[] mIds;

  static
  {
    String[] arrayOfString1 = new String[1];
    arrayOfString1[0] = "TABLE";
    mIds = arrayOfString1;
    String[] arrayOfString2 = new String[2];
    arrayOfString2[0] = "BODY";
    arrayOfString2[1] = "HTML";
    mEndTagEnders = arrayOfString2;
  }

  static Class class$(String paramString)
  {
    Class localClass;
    try
    {
      localClass = Class.forName(paramString);
      return localClass;
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError().initCause(localClassNotFoundException);
    }
  }

  public String[] getEndTagEnders()
  {
    return mEndTagEnders;
  }

  public String[] getIds()
  {
    return mIds;
  }

  public TableRow getRow(int paramInt)
  {
    TableRow localTableRow;
    TableRow[] arrayOfTableRow = getRows();
    if (paramInt < arrayOfTableRow.length)
      localTableRow = arrayOfTableRow[paramInt];
    while (true)
    {
      return localTableRow;
      localTableRow = null;
    }
  }

  public int getRowCount()
  {
    return getRows().length;
  }

  public TableRow[] getRows()
  {
    TableRow[] arrayOfTableRow;
    Class localClass1;
    Class localClass2;
    NodeList localNodeList1 = getChildren();
    if (localNodeList1 != null)
      if (class$org$htmlparser$tags$TableTag == null)
      {
        localClass1 = class$("org.htmlparser.tags.TableTag");
        class$org$htmlparser$tags$TableTag = localClass1;
        NodeClassFilter localNodeClassFilter = new NodeClassFilter(localClass1);
        HasParentFilter localHasParentFilter = new HasParentFilter(null);
        OrFilter localOrFilter = new OrFilter(new AndFilter(localNodeClassFilter, new IsEqualFilter(this)), new AndFilter(new NotFilter(localNodeClassFilter), localHasParentFilter));
        localHasParentFilter.setParentFilter(localOrFilter);
        if (class$org$htmlparser$tags$TableRow != null)
          break label163;
        localClass2 = class$("org.htmlparser.tags.TableRow");
        class$org$htmlparser$tags$TableRow = localClass2;
        NodeList localNodeList2 = localNodeList1.extractAllNodesThatMatch(new AndFilter(new NodeClassFilter(localClass2), localOrFilter), true);
        arrayOfTableRow = new TableRow[localNodeList2.size()];
        localNodeList2.copyToNodeArray(arrayOfTableRow);
      }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          return arrayOfTableRow;
          localClass1 = class$org$htmlparser$tags$TableTag;
        }
        label163: localClass2 = class$org$htmlparser$tags$TableRow;
      }
      arrayOfTableRow = new TableRow[0];
    }
  }

  public String toString()
  {
    return "TableTag\n********\n" + toHtml();
  }
}